package fhjoanneum.itm11.antesk.simplehack;
import java.io.*;

public class SVG
{
	// Members -----------------------------------------------------------
	private String header;
	private String footer;
	private String tags;
	private int x;
	private int y;
	private int height;
	private int width;
	
	// Constructor -------------------------------------------------------
	SVG(int height, int width)
	{
		header = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE " +
				"svg PUBLIC \"-//W3C//DTD SVG 1.1//EN\" \"http://www.w3.or" +
				"g/Graphics/SVG/1.1/DTD/svg11.dtd\"><svg xmlns=\"http://ww" +
				"w.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/" +
				"xlink\" xmlns:ev=\"http://www.w3.org/2001/xml-events\" ve" +
				"rsion=\"1.1\" baseProfile=\"full\" width=\"800\" height=" +
				"\"600\">";	
		footer = "</svg>";
		this.height = height;
		this.width = width;
		this.x = 0;
		this.y = 0;
	}

	
	
	// Methods ===========================================================
	
	// -------------------------------------------------------------------
	public String getHeader(){return header;}
	public String getFooter(){return footer;}
	
	// Create WallTile tag -----------------------------------------------
	public void createWallTileTag(int counter)
	{
		tags += "<image x=\"" + (height*50) + "\" y=\"\" width=\"\" height=\"\" xlink:href=\"\" />";
	}

	// TESTMETHOD
	public void test()
	{
		System.out.println(tags);
	}
	
	// Saves the SVG file ------------------------------------------------
	public void saveSVG()
	{
		try
    {
	    BufferedWriter writer = 
	    		new BufferedWriter(new FileWriter("output.svg"));
	    
	    writer.write(getHeader());
	    writer.newLine();
	    writer.write(tags);
	    writer.newLine();
	    writer.write(getFooter());
    }
    catch (Exception e)
    {
	    // TODO Auto-generated catch block
	    e.printStackTrace();
    }
	}
	
}